package com.alt.www.sort;

import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;
import edu.princeton.cs.algs4.Stopwatch;


/**
 * Created by 27340 on 2017/9/16.
 */
public class SortCompare
{
    public static Double time(String alg, Double[] a){
        Stopwatch stopwatch = new Stopwatch();
        if(alg.equals("Insertion")){

        }else if(alg.equals("Selection")){

        }else if(alg.equals("Shell")){

        }else if(alg.equals("Merge")){

        }else if(alg.equals("Quick")){

        }else if(alg.equals("Heap")){

        }
        return stopwatch.elapsedTime();
    }
    public static long timeRandomInput(String alg, int N , int T){
        long totalTime = 0L;
        Double[] a = new Double[N];
        for (int i = 0; i <T ; i++) {
            //使用算法1将T个长度为N的数组排序
            for (int j = 0; j <N ; j++) {
                a[i] = StdRandom.uniform();
            }
            totalTime += time(alg, a);
        }
        return totalTime;
    }

    public static void main(String[] args) {
        String alg1 = args[0];
        String alg2 = args[1];
        int N = Integer.parseInt(args[2]);
        int T = Integer.parseInt(args[2]);
        double t1 = timeRandomInput("",10,2);
        double t2 = timeRandomInput("",10,2);
        StdOut.printf("for %d random double \n %s is", N, alg1);
        StdOut.printf("%.1f times faster than %s \n  ", t2/t1, alg2);
    }
}
